<?php
/*
# ------------------------------------------------------------------------
# JA Cpanel module for Joomla 1.5
# ------------------------------------------------------------------------
# Copyright (C) 2004-2010 JoomlArt.com. All Rights Reserved.
# @license - PHP files are GNU/GPL V2. CSS / JS are Copyrighted Commercial,
# bound by Proprietary License of JoomlArt. For details on licensing, 
# Please Read Terms of Use at http://www.joomlart.com/terms_of_use.html.
# Author: JoomlArt.com
# Websites:  http://www.joomlart.com -  http://www.joomlancers.com
# Redistribution, Modification or Re-licensing of this file in part of full, 
# is bound by the License applied. 
# ------------------------------------------------------------------------
*/

// no direct access
defined('_JEXEC') or die('Restricted access');

if (!defined('_JACPANEL_HEADER')) {
	define ('_JACPANEL_HEADER', 1);
	JHTML::_('behavior.mootools');			
	echo "<script src=\"".JURI::base()."/modules/mod_jacpanel/ja.cpanel.js\" type=\"text/javascript\"></script>\n";

	$filename = JPATH_SITE.DS.'templates'.DS.$mainframe->getTemplate().DS.'css'.DS.'ja.cpanel.css';
	$css_path = JURI::base().'templates/'.$mainframe->getTemplate().'/css/';
	if(!file_exists($filename)){
		$css_path = JURI::base().'modules/mod_jacpanel/';
	}
	JHTML::stylesheet('ja.cpanel.css', $css_path);
}

$moduleclass_sfx = $params->get('moduleclass_sfx', '');
$cpanelid = $params->get('cpanelid', 'ja-cpanel');
$default = $params->get('default', 'hide');
$tiptext = $params->get('tiptext', '');

$height = $params->get('height', 0);
$width = $params->get('width', 0);
$direction = $params->get('direction', 'down'); //down, up, left, right
?>
<a href="" onclick="return false;" id="<?php echo $cpanelid;?>-switcher" title="<?php echo $tiptext;?>" class="ja-cpanel-switcher<?php echo $moduleclass_sfx;?>"><span><?php echo $module->title;?></span></a>
<script type="text/javascript">
	/*<![CDATA[*/
	<?php if ($default=='hide'): 
		$width_style='';
		$height_style='';
		if ($width) $width_style = "width:0;";
		if ($height) $height_style = "height:0;";
	?>
	document.write ('<style type="text\/css">#<?php echo $cpanelid;?> {visibility:hidden;overflow:hidden;<?php echo $width_style.$height_style;?>}<\/style>');
	<?php endif; ?>
window.addEvent ('domready', function() {
	new JACPanel ('<?php echo $cpanelid;?>',{
		'status':'<?php echo $default;?>',
		'width':<?php echo $width;?>,
		'height':<?php echo $height;?>,
		'dir':'<?php echo $direction;?>'
	});
	/*]]>*/
});	
</script>